/**
 * Created by ClearLiang on 2019/4/19
 * Function:
 * Desc:
 */
import React, {Component} from 'react';
import {ImageBackground, StyleSheet, Text, TouchableOpacity, View, FlatList} from 'react-native';

class Item extends Component {
    render(ItemData) {
        return (
            <View style={styles.item}>
                <TouchableOpacity onPress={this.props.press}>
                    <ImageBackground resizeMode={'contain'} style={styles.img} source={{uri: ItemData.url}}>
                        <Text numberOfLines={1} style={styles.item_text}>
                            {this.props.title}
                        </Text>
                    </ImageBackground>
                </TouchableOpacity>
            </View>
        );
    }
}

export default class List_Goods extends Component {

    // 初始化state
    constructor(props) {
        super(props);
        this.state = {
            count:0,
        };
    }

    // 加载后
    componentDidMount(): void {
        console.log('componentDidMount')
    }

    // 移除前
    componentWillUnmount(): void {
        console.log('componentWillUnmount')
    }

    render() {
        let goods = this.props.data;
        return (
            <View>
                {/*<FlatList
                    style={}
                    renderItem={this.Item.bind(this)}
                    data={goods}
                />*/}
            </View>

        );
    }
}

// 构建样式
const styles = StyleSheet.create({
    item:{
        flex:1,
        flexDirection:'column',
        marginLeft:5,
        marginRight:5,
        height:140,
        borderWidth:1,
        borderColor:'#ddd'
    },
    img:{},
    item_text:{},
});
